import time

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver = webdriver.Chrome()
driver.maximize_window()
driver.get("https://docs.qq.com/desktop/?fromsrc=homepage")
time.sleep(3)
driver.switch_to.frame('login_frame')
driver.find_element_by_id('switcher_plogin').click()
driver.find_element_by_id('u').send_keys('398444475')
driver.find_element_by_id('p').send_keys('po520131400')
driver.find_element_by_id('login_button').click()
time.sleep(3)

driver.switch_to.default_content()

time.sleep(3)
driver.find_element_by_css_selector(".icon.icon-new-item").click()
time.sleep(3)
#driver.find_element_by_xpath("//li[@class='first-line show']//div[@class='file-doc-icon svg-icon']/../div[@class='new-options-text-container']/./p[text()='在线文档']").click()
driver.find_element_by_xpath("//li[@class='first-line show']//p[text()='在线文档']").click()




'''
driver.find_element_by_class_name('search-input').send_keys('ID')
time.sleep(5)
driver.find_element_by_xpath("//div//span//span//span[text()='ID']").click()
time.sleep(3)

handles = driver.window_handles
driver.switch_to.window(handles[-1])
time.sleep(3)
driver.find_element_by_class_name('.titlebar-icon.titlebar-icon-more').click()
driver.find_element_by_xpath("//li[text()='修订记录']").click()
driver.close()
driver.switch_to.window(handles[0])
time.sleep(5)

driver.find_element_by_css_selector('.sidebar-item-text.sidebar-item-text-bold').click()
driver.find_element_by_id('account-avatar-container').click()
driver.find_element_by_id("logout-account").click()



'''
time.sleep(5)
driver.quit()

